<?php
class Clu_Auth_Adapter_DbTable extends Zend_Auth_Adapter_DbTable 
{
    public function authenticate()
    {
        //Add additional query checks here
        $db = Zend_Db_Table::getDefaultAdapter();
        //no need to check for status. Unactivated users can also login now, with anonymous permissions
        $sql = "SELECT * FROM users WHERE name=" . $db->quote($this->_identity, 'STRING');// . " AND status IN (1)";
        
        $userRowset = $db->query($sql);
        $row = $userRowset->fetch();
        if ($row['id'] > 0)
            return parent::authenticate();
        else
            return new  Zend_Auth_Result(Zend_Auth_Result::FAILURE, 0, array(__("Wrong user name") . "<br/>"));     
    }
}

?>
